<script type="text/javascript">
  $(function() {
    $('#admin_Cqpatient_datagrid').datagrid({
      url: '{:U("Cqpatient/view")}',
      queryParams: {
        mediatypeid: "{$mediatypeid}",
        type: "{$type}",
        mediaflag: "{$mediaflag}",
        zhtype: "{$zhtype}"
      },
      fit: true,
      fitColumns: true, //有了这个属性就不能用冻结列
      border: false,
      pagination: true,
      idField: 'id',
      pageSize: 50,
      pageList: [10, 20, 30, 40, 50, 100, 200, 300, 500, 600, 800, 1000],
      sortName: 'id',
      sortOrder: 'desc',
      rownumbers: false,
      striped: true,
      checkOnSelect: true,
      selectOnCheck: true,
      nowrap: false,
      singleSelect: true,
      showFooter: true,
      rowStyler: function(index, row) {
        if (row != null) {
          if (row.status == '已预约') {
            return 'background-color:1;color:red;font-weight1:bold;';
          }
          var nowtime = formatterTime(new Date());
          if (row.yuyuetime < nowtime) {
            return 'background-color:1;color:#408080;';
          }
          if (row.status == '有意向') {
            return 'background-color:1;color:#873fff;';
          }
        }
      },
      onLoadSuccess: function(data) {
        $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
        if (data.total == 0) {
          showMsg('没有数据，请重新选择查询条件！');
        }
        //console.info($('#admin_Cqpatient_datagrid').datagrid('options').pageNumber);
        $("#cqpatient_show_a").text(data.other.a);
        $("#cqpatient_show_b").text(data.other.b);
        $("#cqpatient_show_c").text(data.other.c);
        $("#cqpatient_show_d").text(data.other.d);
      },
      frozenColumns: [
        [{
          title: '编号',
          field: 'remark',
          width: 100,
          sortable: true,
          checkbox: true
        }]
      ],
      columns: [
        [{
          title: 'ID',
          field: 'id',
          width: 100,
          sortable: true,
          hidden: true
        }, {
          title: '编号',
          field: 'num',
          width: 80,
          hidden: true,
          sortable: true
        }, {
          title: '姓名',
          field: 'name',
          width: 60,
          hidden: true,
          sortable: true
        }, {
          title: '性别',
          field: 'sex',
          hidden: true,
          width: 35,
          sortable: true
        }, {
          title: '年龄',
          hidden: true,
          field: 'age',
          width: 35,
          sortable: true
        }, {
          title: '基本信息',
          field: 'name1',
          width: 80,
          hidden: false,
          sortable: false,
          formatter: function(value, rows, index) {
            return '<font>姓名：</font>' + rows.name + '<br><font>性别：</font>' + rows.sex + '<br><font>年龄：</font>' + rows.age + '<br><font>客户分类：</font>' + rows.kehufenlei;
          }
        }, {
          title: '电话',
          field: 'tel',
          hidden: true,
          width: 90,
          sortable: true,
          formatter: function(value, rows, index) {
            // console.log(i);
            if(isjiami=='否'){
              if(rows.username!=useraccount&&value!=''){
                return '*******';
              }else{
                return value;
              }
            }else{
              return value;
            }
          }
        }, {
          title: 'QQ',
          field: 'qq',
          hidden: true,
          width: 90,
          sortable: true,
          formatter: function(value, rows, index) {
            // console.log(i);
            if(isjiami=='否'){
              if(rows.username!=useraccount&&value!=''){
                return '*******';
              }else{
                return value;
              }
            }else{
              return value;
            }
          }
        }, {
          title: '微信',
          field: 'weixin',
          hidden: true,
          width: 90,
          sortable: true,
          formatter: function(value, rows, index) {
            // console.log(i);
            if(isjiami=='否'){
              if(rows.username!=useraccount&&value!=''){
                return '*******';
              }else{
                return value;
              }
            }else{
              return value;
            }
          }
        }, {
          title: '联系方式',
          field: 'tel1',
          width: 130,
          hidden: false,
          sortable: false,
          formatter: function(value, rows, index) {
            return '<font>电话：</font>' + rows.tel + '<br><font>QQ：</font>' + rows.qq + '<br><font>微信：</font>' + rows.weixin;
          }
        }, {
          title: '咨询内容|备注|回访',
          field: 'zixun1',
          width: 450,
          sortable: false,
          hidden: true,
          formatter: function(value, rows, index) {
            return '<font color=gray>【咨询内容】：</font>' + rows.zixun + '<br><font color=gray>【跟踪程度】：</font>' + rows.genzong + '<br><font color=gray>【备注】：</font>' + rows.remark + '<br><font color=green>【回访】：</font>' + rows.cqpatienthuifangcount + '次';
          }
        }, {
          title: '所属医院',
          field: 'hospital',
          hidden: true,
          width: 120,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '所属项目',
          field: 'project',
          hidden: true,
          width: 120,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '所属科室',
          field: 'depart',
          hidden: true,
          width: 120,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '医院|项目|科室',
          field: 'hospital1',
          width: 150,
          hidden: true,
          sortable: false,
          formatter: function(value, rows, index) {
            return '<font>部门：</font>' + rows.part.name + '<br><font>医院：</font>' + rows.hospital.name + '<br><font>项目：</font>' + rows.project.name;
          }
        }, {
          title: '疾病名称',
          field: 'disease',
          hidden: true,
          width: 80,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '渠道',
          field: 'mediatype',
          width: 60,
          hidden: true,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '媒体来源',
          field: 'media',
          width: 100,
          hidden: true,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '回访次数',
          field: 'cqpatienthuifangcount',
          hidden: true,
          width: 60,
          sortable: true
        }, {
          title: '渠道|媒体来源|疾病',
          field: 'mediatype1',
          width: 150,
          hidden: false,
          sortable: false,
          formatter: function(value, rows, index) {
            return '<font>渠道：</font>' + rows.mediatype.name +
              '<br><font>媒体来源：</font>' + rows.media.name +
              '<br><font>疾病名称：</font>' + rows.diseasename +
              '<br><font>回访次数：</font>' + rows.cqpatienthuifangcount +
              '<br><font>几手病人：</font>' + rows.jishou;
          }
        }, {
          title: '本地外地',
          field: 'islocal',
          hidden: true,
          width: 100,
          sortable: true
        }, {
          title: '专家号',
          field: 'zhuanjia',
          hidden: true,
          width: 100,
          sortable: true
        }, {
          title: '本地外地|专家号|客服',
          field: 'islocal1',
          width: 150,
          hidden: true,
          sortable: false,
          formatter: function(value, rows, index) {
            return '<font>本地外地：</font>' + rows.islocal + '<br><font>专家号：</font>' + rows.zhuanjia + '<br><font>客服：</font>' + rows.user.account;
          }
        }, {
          title: '所属部门',
          field: 'part',
          hidden: true,
          width: 120,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '状态',
          field: 'status',
          hidden: false,
          width: 60,
          sortable: true
        }, {
          title: '是否治疗',
          field: 'iszhiliao',
          hidden: true,
          width: 100,
          sortable: true
        }, {
          title: '是否消费',
          field: 'isxiaofei',
          hidden: true,
          width: 100,
          sortable: true
        }, {
          title: '医生',
          field: 'doctor',
          hidden: true,
          width: 100,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (!value == '') {
                return value.name;
              } else {
                return '<font color=red>空</font>';
              }
            }
          }
        }, {
          title: '状态|是否治疗|是否消费|医生',
          field: 'status1',
          width: 200,
          hidden: true,
          sortable: false,
          formatter: function(value, rows, index) {
            var doctorname = "";
            if (rows.doctor != '' && rows.doctor != null) {
              doctorname = rows.doctor.name;
            }
            return '<font color=black>【状态】：</font>' + rows.status + '<br><font>是否治疗：</font>' + rows.iszhiliao + '<br><font>是否消费：</font>' + rows.isxiaofei + '<br><font>医生：</font>' + doctorname;
          }
        }, {
          title: '对话备注',
          field: 'talkremark',
          hidden: true,
          width: 100,
          sortable: true
        }, {
          title: '所属资产',
          field: 'ofqq1',
          width: 150,
          hidden: false,
          sortable: false,
          formatter: function(value, rows, index) {
            //return '<font>所属资产：</font>'+rows.ofzichanname;
            return rows.ofzichanname;
          }
        }, {
          title: '客服',
          field: 'user',
          hidden: false,
          width: 70,
          sortable: true,
          formatter: function(value, rows, index) {
            if (value != null) {
              if (value != '') {
                return value.account;
              }
            } else {
              return '<font color=red>空</font>';
            }
          }
        }, {
          title: '添加时间',
          field: 'addtime',
          width: 80,
          sortable: true
        }, {
          title: '修改记录',
          field: 'edit_log',
          hidden: true,
          width: 100,
          sortable: true
        }]
      ],
      view: detailview,
      detailFormatter: function(rowIndex, rowData) {
        return '<span>【编号】:' + rowData.num + '</span><span>【日期】:' + rowData.addtime + '</span><span>【客服】:' + rowData.username + '</span>' +
          '<br><table width=900 border=1 cellspacing=1 cellpadding=1>' +
          '<tr><td width=100 align=right>姓名：</td><td width=100>' + rowData.name + '</td><td align=right>年龄：</td><td>' + rowData.age + '</td><td align=right>性别：</td><td>' + rowData.sex + '</td></tr>' +
          '<tr><td align=right>渠道：</td><td>' + rowData.mediatypename + '</td><td align=right>媒体来源：</td><td>' + rowData.medianame + '</td><td align=right>疾病名称：</td><td>' + rowData.diseasename + '</td></tr>' +
          '<tr><td align=right>部门：</td><td>' + rowData.part.name + '</td><td align=right>医院：</td><td>' + rowData.hospital.name + '</td><td align=right>项目：</td><td>' + rowData.project.name + '</td></tr>' +
          '<tr><td align=right>客服：</td><td colspan=3>' + rowData.username + '</td></tr>' +
          '<tr><td align=right height=50>咨询内容：</td><td colspan=5>' + rowData.zixun + '</td></tr>' +
          '<tr><td align=right height=50>跟踪程度：</td><td colspan=5>' + rowData.genzong + '</td></tr>' +
          '<tr><td align=right height=50>备注：</td><td colspan=5>' + rowData.remark + '</td></tr>' +
          '<tr><td align=right>所属QQ：</td><td>' + rowData.ofqq + '</td><td align=right>所属微信：</td><td colspan=3>' + rowData.ofweixin + '</td></tr>' +
          '<tr><td align=right>首次回访时间：</td><td colspan=5>' + rowData.huifangtime + '</td></tr>' +
          '<tr><td align=right>添加时间：</td><td colspan=5>' + rowData.addtime + '</td></tr>' +
          '</table>' +
          '<p>回访记录：</p>' +
          '<div style="padding:0px"><table id="admin_CqpatientHuifang_datagrid_' + rowIndex + '"></table></div>' +
          '<p>修改记录: ' + rowData.edit_log + '</p>';
      },
      onExpandRow: function(index, row) {
        $('#admin_CqpatientHuifang_datagrid_' + index).datagrid({
          //url: '{:U("Cqpatienthuifang/view")}',
          data: row.cqpatienthuifang,
          queryParams: {
            cqpatientid: row.id
          },
          //fitColumns: false,//有了这个属性就不能用冻结列
          border: true,
          pagination: false,
          idField: 'id',
          pageSize: 50,
          pageList: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
          sortName: 'id',
          sortOrder: 'desc',
          rownumbers: true,
          striped: true,
          checkOnSelect: true,
          selectOnCheck: false,
          nowrap: false,
          singleSelect: true,
          showFooter: true,
          rowStyler: function(index, row) {
            return 'line_eight:50px;';
          },
          onLoadSuccess: function(data) {
            //$('#admin_YumingSub_datagrid-').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
            if (data.total == 0) {
              showMsg('没有数据，请重新选择查询条件！');
            }
            //console.info($('#admin_Yuming_datagrid').datagrid('options').pageNumber);
          },
          frozenColumns: [
            [{
              title: '编号',
              field: 'id',
              width: 150,
              sortable: true,
              checkbox: true
            }]
          ],
          columns: [
            [{
              title: '回访时间',
              field: 'addtime',
              halign: 'center',
              width: 150
            }, {
              title: '客服',
              field: 'username',
              halign: 'center',
              width: 100
            }, {
              title: '回访内容',
              field: 'content',
              halign: 'center',
              width: 400
            }, {
              title: '聊天内容',
              field: 'liaotian',
              halign: 'center',
              width: 200,
              formatter: function(value, rows, index) {
                return '<span title=' + value + '>' + value + '</font>';
              }
            }, {
              title: '跟踪程度',
              field: 'genzong',
              halign: 'center',
              width: 200
            }, {
              title: '备注',
              field: 'remark',
              halign: 'center',
              width: 200
            }, {
              title: '下次回访时间',
              field: 'nexttime',
              halign: 'center',
              width: 150
            }]
          ],
          onResize: function() {
            $('#admin_Cqpatient_datagrid').datagrid('fixDetailRowHeight', index);
          },
          onLoadSuccess: function() {
            setTimeout(function() {
              $('#admin_Cqpatient_datagrid').datagrid('fixDetailRowHeight', index);
            }, 0);
          }
        });
      },
      onClickRow: function(index, row) {
        var o = row;
        $('#admin_Cqpatient_Form_east').form('load', o);
        $('#admin_CqpatientEast_ofzichanid').val(o.ofzichanname);
        $('#admin_CqpatientEast_mediaid').val(o.medianame);
        $('#admin_CqpatientEast_diseaseid').val(o.diseasename);
        $('#admin_CqpatientHuifang_datagrid_east').datagrid({
          //url: '{:U("Cqpatienthuifang/view")}',
          data: row.cqpatienthuifang,
          queryParams: {
            cqpatientid: row.id
          },
          //fitColumns: false,//有了这个属性就不能用冻结列
          border: false,
          pagination: false,
          idField: 'id',
          pageSize: 50,
          pageList: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500],
          sortName: 'id',
          sortOrder: 'desc',
          rownumbers: true,
          striped: true,
          checkOnSelect: true,
          selectOnCheck: false,
          nowrap: false,
          singleSelect: true,
          showFooter: true,
          rowStyler: function(index, row) {
            return 'line_eight:50px;';
          },
          onLoadSuccess: function(data) {
            //$('#admin_YumingSub_datagrid-').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
            if (data.total == 0) {
              showMsg('没有数据，请重新选择查询条件！');
            }
            //console.info($('#admin_Yuming_datagrid').datagrid('options').pageNumber);
          },
          frozenColumns: [
            [{
              title: '编号',
              field: 'id',
              width: 150,
              sortable: true,
              checkbox: true
            }]
          ],
          columns: [
            [{
              title: '回访时间',
              field: 'addtime',
              halign: 'center',
              width: 150
            }, {
              title: '客服',
              field: 'username',
              halign: 'center',
              width: 100
            }, {
              title: '回访内容',
              field: 'content',
              halign: 'center',
              width: 400
            }, {
              title: '聊天内容',
              field: 'liaotian',
              halign: 'center',
              width: 200,
              formatter: function(value, rows, index) {
                return '<span title=' + value + '>' + value + '</font>';
              }
            }, {
              title: '跟踪程度',
              field: 'genzong',
              halign: 'center',
              width: 200
            }, {
              title: '备注',
              field: 'remark',
              halign: 'center',
              width: 200
            }, {
              title: '下次回访时间',
              field: 'nexttime',
              halign: 'center',
              width: 150
            }]
          ],
          onResize: function() {
            $('#admin_Cqpatient_datagrid').datagrid('fixDetailRowHeight', index);
          },
          onLoadSuccess: function() {
            setTimeout(function() {
              $('#admin_Cqpatient_datagrid').datagrid('fixDetailRowHeight', index);
            }, 0);
          }
        });
      },
      toolbar: [{
        text: '刷新',
        iconCls: 'icon-reload',
        handler: function() {
          $('#admin_Cqpatient_datagrid').datagrid('reload');
        }
      }, <?php if(in_array("Admin/Cqpatient/add",session('user.nodesname'))){ ?>
      '-', {
        text: '<span style="color1:red;font-size:15px;font-weight:bold">增加</span>',
        iconCls: 'icon-add',
        handler: function() {
          admin_Cqpatient_appendFun();
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/edit",session('user.nodesname'))){ ?>
      '-', {
        text: '<span style="color1:red;font-size:15px;font-weight:bold">修改</span>',
        iconCls: 'icon-edit',
        handler: function() {
          admin_Cqpatient_editFun();
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/delete",session('user.nodesname'))){ ?>
      '-', {
        text: '删除',
        iconCls: 'icon-delete',
        handler: function() {
          admin_Cqpatient_removeFun();
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/chakan",session('user.nodesname'))){ ?>
      '-', {
        text: '<span style="color1:red;font-size:15px;font-weight:bold">查看</span>',
        iconCls: 'icon-chakan',
        handler: function() {
          admin_Cqpatient_chakanFun();
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/yuyue",session('user.nodesname'))){ ?>
      '-', {
        text: '一键预约',
        iconCls: 'icon-yuyue',
        handler: function() {
          admin_Cqpatient_yuyueFun();
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/huifang",session('user.nodesname'))){ ?>
      '-', {
        text: '回访',
        iconCls: 'icon-huifang',
        handler: function() {
          admin_Cqpatient_huifangFun();
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/chakanhuifang",session('user.nodesname'))){ ?>
      '-', {
        text: '查看今日回访病人',
        iconCls: 'icon-jinrihuifang',
        handler: function() {
          $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
          $('#admin_Cqpatient_datagrid').datagrid('load', { chakan: "huifang" });
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/weihuifang",session('user.nodesname'))){ ?>
      '-', {
        text: '过期未回访病人',
        iconCls: 'icon-weihuifang',
        handler: function() {
          $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
          $('#admin_Cqpatient_datagrid').datagrid('load', { chakan: "weihuifang" });
        }
      }, <?php }?>
  <?php if(in_array("Admin/Cqpatient/duanxin",session('user.nodesname'))){ ?>
      '-', {
        text: '发送短信',
        iconCls: 'icon-duanxin',
        handler: function() {
          admin_Cqpatient_duanxinFun();
        }
      }, <?php }?><?php if(in_array("Admin/Cqpatient/zhuanyi",session('user.nodesname'))){ ?>'-', {
      text: '转移病人',
      iconCls: 'icon-undo',
      handler: function() {
        admin_Cqpatient_zhuanyiFun();
      }
    },<?php }?>'-',{
      text: '<input name="mohu" id="Cqatient_search_mohu"/>'
    },{
      text: '模糊查询',
      iconCls: 'icon-search',
      handler: function(){
        admin_Cqatient_seachMohuFun();
      }
    }]
  });

    var p_admin_Cqpatient_datagrid = $('#admin_Cqpatient_datagrid').datagrid('getPager');
    $(p_admin_Cqpatient_datagrid).pagination({
      pageSize: 50, //每页显示的记录条数，默认为10 
      pageList: [10, 20, 30, 40, 50, 100, 200], //可以设置每页记录条数的列表 
      beforePageText: '第', //页数文本框前显示的汉字 
      afterPageText: '页 共 {pages} 页',
      displayMsg: '当前显示 {from}到{to} 条记录 共 {total} 条记录',
      buttons: [{
        text: 'A:<span id="cqpatient_show_a">0</span> B:<span id="cqpatient_show_b">0</span> C:<span id="cqpatient_show_c">0</span> D:<span id="cqpatient_show_d">0</span>',
      }, '-']
    });
  });

  //模糊查询
  function admin_Cqatient_seachMohuFun(){
    var Cqatient_search_mohu=$("#Cqatient_search_mohu").val();
    $('#admin_Cqpatient_datagrid').datagrid('load',{mohu:Cqatient_search_mohu});
  }
  function admin_Cqpatient_chakanFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    //console.info(rows);
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
    } else {
      $('<div/>').dialog({
        href: '{:U("Cqpatient/chakan")}',
        width: 700,
        top: 0,
        height: $(window).height(),
        modal: true,
        title: '查看病人信息',
        onClose: function() {
          $(this).dialog('destroy');
        },
        onLoad: function() {
          var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
          var o = rows[0];
          $('#admin_CqpatientEdit_Form').form('load', o);
          $("#admin_CqpatientEdit_edit_log").html(o.edit_log);
          $("#admin_CqpatientEdit_liaotian").text(o.liaotian);
          $('#admin_CqpatientEdit_Cqpatientinform').datagrid({
            multiple: true,
            nowrap: false,
            url: '{:U("Cqpatientinform/view")}',
            queryParams: {
              Cqpatientid: o.id
            },
            panelWidth: 500,
            panelHeight: 300,
            idField: 'id',
            textField: 'name',
            sortName: 'id',
            sortOrder: 'desc',
            pagination: false,
            fitColumns: false,
            pageSize: 50,
            pageList: [10, 20, 30, 40, 50],
            frozenColumns: [
              [{
                title: '编号',
                field: 'id',
                width: 150,
                sortable: true,
                checkbox: true
              }]
            ],
            columns: [
              [{
                title: '回访时间',
                field: 'addtime',
                halign: 'center',
                width: 150
              }, {
                title: '用户',
                field: 'username',
                halign: 'center',
                width: 100
              }, {
                title: '回访内容',
                field: 'content',
                halign: 'center',
                width: 80
              }, {
                title: '备注',
                field: 'informremark',
                halign: 'center',
                width: 150
              }, {
                title: '下次回访时间',
                field: 'nexttime',
                halign: 'center',
                width: 150
              }]
            ]
          });
        }
      });
    }
  }

  function admin_Cqpatient_editFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    //console.info(rows);
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
      return false;
    }
    if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
      return false;
    }
    if (rows[0].status == '已预约') {
      showMsg('已预约不能再编辑');
      return false;
    }
    if (rows[0].username != useraccount) {
      if(useraccount != 'admin'){
        showMsg('不能编辑别人的记录');
        return false;
      }
    }
    $('<div/>').dialog({
      href: '{:U("Cqpatient/edit")}',
      width: 700,
      top: 0,
      height: $(window).height(),
      modal: true,
      title: '编辑',
      buttons: [{
        text: '编辑',
        iconCls: 'icon-edit',
        handler: function() {
          var d = $(this).closest('.window-body');
          $.messager.progress({
            title: '请稍候',
            msg: '正在提交！请稍后...'
          });
          $('#admin_CqpatientEdit_Form').form('submit', {
            url: '{:U("Cqpatient/edit")}',
            onSubmit: function() {
              var isValid = $(this).form('validate');
              if (!isValid) {
                $.messager.progress('close'); // 如果表单是无效的则隐藏进度条
              }
              return isValid; // 返回false终止表单提交
            },
            success: function(r) {
              $.messager.progress('close');
              if (r.status == 1) {
                $('#admin_Cqpatient_datagrid').datagrid('reload');
                d.dialog('destroy');
                showMsg(r.info);
              } else {
                showMsg(r.info);
              }
            }
          });
        }
      }],
      onClose: function() {
        $(this).dialog('destroy');
      },
      onLoad: function() {
        var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
        var o = rows[0];
        $('#admin_CqpatientEdit_Form').form('load', o);
      }
    });
  }

  function admin_Cqpatient_appendFun() {
    $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    $('<div/>').dialog({
      href: '{:U("Cqpatient/add")}',
      width: 700,
      top: 0,
      height: $(window).height(),
      modal: true,
      title: '添加',
      buttons: [{
        text: '增加',
        iconCls: 'icon-add',
        handler: function() {
          var d = $(this).closest('.window-body');
          $.messager.progress({
            title: '请稍候',
            msg: '正在提交！请稍后...'
          });
          var data = $("#admin_CqpatientAdd_Form").form("getData");
          $.ajax({
            type: 'POST',
            url: '{:U("Cqpatient/add")}',
            data: data,
            beforeSend: function(XMLHttpRequest) {
              var isValid = $('#admin_CqpatientAdd_Form').form('validate');
              if (!isValid) {
                $.messager.progress('close'); // 如果表单是无效的则隐藏进度条
                return isValid; // 返回false终止表单提交
              }
            },
            success: function(r) {
              $.messager.progress('close');
              if (r.status == 1) {
                $('#admin_Cqpatient_datagrid').datagrid('load');
                d.dialog('destroy');
                showMsg(r.info);
              } else {
                showMsg(r.info);
              }
            }
          });
        }
      }],
      onClose: function() {
        $(this).dialog('destroy');
      }
    });
  }

  function admin_Cqpatient_yuyueFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    if (rows.length > 1) {
      showMsg('不能同时预约多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要预约的记录！');
    } else if (rows[0].status == '已预约') {
      showMsg('已经预约过了，不能再次预约！');
    } else {
      $.ajax({
        type: 'POST',
        url: APP + '/Patientcommon/CqpatientRepeat',
        data:rows[0],
        success: function(res){
          var res=JSON.parse(res);
          $.messager.progress('close');
          if (res.total>0) {
            window.patientdata=res.rows;
            $('<div/>').dialog({
              href: TMPL + '/Patient/patientrepeat.html',
              width: 1300,top:0,
              height:600,
              modal: true,
              title: '以下为重复数据，请您详细对比后再进行新增！',
              onClose: function(){
                $(this).dialog('destroy');
              }
            });
          }
          else {
            showMsg("没有重复数据！可以继续添加！");
          }
        }
      });
      $.messager.confirm('确认', '您确认一键预约吗？', function(r) {
        if (r) {
          $.messager.progress({
            title: '请稍候',
            msg: '正在提交！请稍后...'
          });
          $.ajax({
            type: 'POST',
            url: '{:U("Cqpatient/yuyue")}',
            data: { id: rows[0].id },
            success: function(r) {
              $.messager.progress('close');
              if (r.status == 1) {
                $('#admin_Cqpatient_datagrid').datagrid('load');
                showMsg(r.info);
                $('<div/>').dialog({
                  href: APP + '/Patient/edit',
                  width: 780, top: 0,
                  height: $(window).height(),
                  modal: true,
                  title: '编辑',
                  buttons: [{
                    text: '编辑',
                    iconCls: 'icon-edit',
                    handler: function () {
                      var d = $(this).closest('.window-body');
                      $.messager.progress({
                        title: '请稍候',
                        msg: '正在提交！请稍后...'
                      });
                      $('#admin_PatientEdit_Form').form('submit', {
                        url: APP + '/Patient/edit',
                        onSubmit: function () {
                          var isValid = $(this).form('validate');
                          if (!isValid) {
                            $.messager.progress('close');	// 如果表单是无效的则隐藏进度条
                          }
                          return isValid;	// 返回false终止表单提交
                        },
                        success: function (r) {
                          $.messager.progress('close');
                          if (r.status == 1) {
                            // $('#admin_Patient_datagrid').datagrid('reload');
                            d.dialog('destroy');
                            showMsg(r.info);
                          }
                          else {
                            showMsg(r.info);
                          }
                        }
                      });
                    }
                  }],
                  onClose: function () {
                    $(this).dialog('destroy');
                  },
                  onLoad: function () {
                    var o =  r.data;
                    $('#admin_PatientEdit_Form').form('load', o);
                    if (rows[0].status == '已到') {
                      if ("admin" != "<?php echo session('user.account');?>") {
                        disableForm('admin_PatientEdit_Form', true);
                        $("form[id='" + admin_PatientEdit_Form + "'] textarea").attr("disabled", "");
                        $('#addremark').removeAttr("disabled");
                      }
                    }
                  }
                });
              } else {
                showMsg(r.info);
              }
              //layout_center_addTab('__APP__/Admin/Patient/index');
            }
          });
        }
      });
    }
  }

  function admin_Cqpatient_huifangFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
    } else if (rows[0].status == '已到') {
      showMsg('已经到院，不能回访！');
    } else {
      $("#layout_center_tabs").tabs('close', '客户回访管理');
      var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
      var o = rows[0];
      $('<div/>').dialog({
        href: APP + '/Cqpatienthuifang/index/cqpatientid/' + o.id,
        width: 800,
        top: 0,
        height: 450,
        modal: true,
        title: '回访',
        closable:true,
        onBeforeClose:function(){
          var d = $(this).closest('.window-body');
          d.dialog('destroy');
        }
      });
    }
  }

  function admin_Cqpatient_xiaofeizhiliaoFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
    } else {
      $('<div/>').dialog({
        href: TMPL + '/Cqpatient/xiaofeizhiliao.html',
        width: 700,
        top: 0,
        height: 450,
        modal: true,
        title: '设置消费和治疗',
        buttons: [{
          text: '确认',
          iconCls: 'icon-edit',
          handler: function() {
            var d = $(this).closest('.window-body');
            $.messager.progress({
              title: '请稍候',
              msg: '正在提交！请稍后...'
            });
            $('#admin_CqpatientEdit_Form').form('submit', {
              url: '{:U("Cqpatient/xiaofeizhiliao")}',
              onSubmit: function() {
                var isValid = $(this).form('validate');
                if (!isValid) {
                  $.messager.progress('close'); // 如果表单是无效的则隐藏进度条
                }
                return isValid; // 返回false终止表单提交
              },
              success: function(r) {
                $.messager.progress('close');
                if (r.status == 1) {
                  $('#admin_Cqpatient_datagrid').datagrid('reload');
                  d.dialog('destroy');
                  showMsg(r.info);
                } else {
                  showMsg(r.info);
                }
              }
            });
          }
        }],
        onClose: function() {
          $(this).dialog('destroy');
        },
        onLoad: function() {
          var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
          var o = rows[0];
          $('#admin_CqpatientEdit_Form').form('load', o);
          if (useraccount != 'admin') {
            if (rows[0].isxiaofei == '已消费') {
              $("#admin_CqpatientEdit_goudaoyuan_isxiaofei").attr("disabled", true);
            }
            if (rows[0].iszhiliao == '已治疗') {
              $("#admin_CqpatientEdit_goudaoyuan_iszhiliao").attr("disabled", true);
            }
          }
          $('#admin_CqpatientEdit_Cqpatientconsume').datagrid({
            multiple: true,
            nowrap: false,
            url: '{:U("Cqpatientconsume/view")}',
            queryParams: {
              Cqpatientid: o.id
            },
            panelWidth: 500,
            panelHeight: 500,
            idField: 'id',
            textField: 'name',
            sortName: 'id',
            sortOrder: 'desc',
            pagination: true,
            fitColumns: false,
            pageSize: 50,
            pageList: [10, 20, 30, 40, 50],
            frozenColumns: [
              [{
                title: '编号',
                field: 'id',
                width: 150,
                sortable: true,
                checkbox: true
              }]
            ],
            columns: [
              [{
                title: '时间',
                field: 'addtime',
                halign: 'center',
                width: 150
              }, {
                title: '用户',
                field: 'username',
                halign: 'center',
                width: 100
              }, {
                title: '消费',
                field: 'money',
                halign: 'center',
                width: 80
              }, {
                title: '备注',
                field: 'xiaofeiremark',
                halign: 'center',
                width: 250
              }]
            ]
          });
        }
      });
    }
  }

  function admin_Cqpatient_duihuabeizhuFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
    } else {
      $('<div/>').dialog({
        href: TMPL + '/Cqpatient/duihuabeizhu.html',
        width: 700,
        top: 0,
        height: 300,
        modal: true,
        title: '对话备注',
        buttons: [{
          text: '确认',
          iconCls: 'icon-edit',
          handler: function() {
            var d = $(this).closest('.window-body');
            $.messager.progress({
              title: '请稍候',
              msg: '正在提交！请稍后...'
            });
            $('#admin_CqpatientEdit_Form').form('submit', {
              url: '{:U("Cqpatient/duihuabeizhu")}',
              onSubmit: function() {
                var isValid = $(this).form('validate');
                if (!isValid) {
                  $.messager.progress('close'); // 如果表单是无效的则隐藏进度条
                }
                return isValid; // 返回false终止表单提交
              },
              success: function(r) {
                $.messager.progress('close');
                if (r.status == 1) {
                  $('#admin_Cqpatient_datagrid').datagrid('reload');
                  d.dialog('destroy');
                  showMsg(r.info);
                } else {
                  showMsg(r.info);
                }
              }
            });
          }
        }],
        onClose: function() {
          $(this).dialog('destroy');
        },
        onLoad: function() {
          var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
          var o = rows[0];
          $('#admin_CqpatientEdit_Form').form('load', o);
        }
      });
    }
  }

  function admin_Cqpatient_duanxinFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
    } else if (rows[0].status == '已到') {
      showMsg('已经到院，不能再发送短信！');
    } else {
      $('<div/>').dialog({
        href: TMPL + '/Cqpatient/duanxin.html',
        width: 700,
        top: 0,
        height: 450,
        modal: true,
        title: '发短信',
        buttons: [{
          text: '确认',
          iconCls: 'icon-edit',
          handler: function() {
            var d = $(this).closest('.window-body');
            var tel = serializeObject($('#admin_Cqpatientmessage_Form')).tel;
            if (tel == '' || tel == null) {
              showMsg("手机号码不能为空！请确认后再试！");
              return false;
            }
            $.messager.progress({
              title: '请稍候',
              msg: '正在发送短信！请稍后...'
            });
            $('#admin_Cqpatientmessage_Form').form('submit', {
              url: '{:U("Cqpatient/duanxin")}',
              onSubmit: function() {
                var isValid = $(this).form('validate');
                if (!isValid) {
                  $.messager.progress('close'); // 如果表单是无效的则隐藏进度条
                }
                return isValid; // 返回false终止表单提交
              },
              success: function(r) {
                $.messager.progress('close');
                if (r.status == 0) {
                  d.dialog('destroy');
                  showMsg(r.info);
                } else {
                  showMsg(r.info);
                }
              }
            });
          }
        }],
        onClose: function() {
          $(this).dialog('destroy');
        },
        onLoad: function() {
          var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
          var o = rows[0];
          $('#admin_Cqpatientmessage_Form').form('load', o);
          $('#admin_CqpatientEdit_Cqpatientmessage').datagrid({
            multiple: true,
            nowrap: true,
            url: '{:U("Cqpatientmessage/view")}',
            queryParams: {
              Cqpatientid: o.id
            },
            //panelWidth : 450,
            //panelHeight : 300,
            idField: 'id',
            textField: 'name',
            sortName: 'id',
            sortOrder: 'desc',
            pagination: false,
            fitColumns: true,
            pageSize: 50,
            pageList: [10, 20, 30, 40, 50],
            frozenColumns: [
              [{
                title: '编号',
                field: 'id',
                width: 150,
                sortable: true,
                checkbox: true
              }]
            ],
            columns: [
              [{
                title: '发送时间',
                field: 'addtime',
                halign: 'center',
                width: 150
              }, {
                title: '用户',
                field: 'username',
                halign: 'center',
                width: 100
              }, {
                title: '发送状态',
                field: 'status',
                halign: 'center',
                width: 100
              }, {
                title: '发送内容',
                field: 'content',
                halign: 'center',
                width: 250,
                formatter: function(value, row, index) {
                  return '<span title="' + value + '">' + value + '</span>';
                }
              }]
            ]
          });
        }
      });
    }
  }

  function admin_Cqpatient_zhuanyiFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    //console.info(rows);
    if (rows.length > 1) {
      showMsg('不能同时编辑多条记录，请选择一条！');
      $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    } else if (rows.length == 0) {
      showMsg('请勾选要编辑的记录！');
    } else {
      $('<div/>').dialog({
        href: '{:U("Cqpatient/zhuanyi")}',
        width: 700,
        top: 0,
        height: 200,
        modal: true,
        title: '转移病人',
        buttons: [{
          text: '确认转移',
          iconCls: 'icon-edit',
          handler: function() {
            var d = $(this).closest('.window-body');
            $.messager.progress({
              title: '请稍候',
              msg: '正在提交！请稍后...'
            });
            $('#admin_CqpatientEdit_Form').form('submit', {
              url: '{:U("Cqpatient/zhuanyi")}',
              onSubmit: function() {
                var isValid = $(this).form('validate');
                if (!isValid) {
                  $.messager.progress('close'); // 如果表单是无效的则隐藏进度条
                }
                return isValid; // 返回false终止表单提交
              },
              success: function(r) {
                $.messager.progress('close');
                if (r.status == 1) {
                  $('#admin_Cqpatient_datagrid').datagrid('reload');
                  d.dialog('destroy');
                  showMsg(r.info);
                } else {
                  showMsg(r.info);
                }
              }
            });
          }
        }],
        onClose: function() {
          $(this).dialog('destroy');
        },
        onLoad: function() {
          var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
          var o = rows[0];
          $('#admin_CqpatientEdit_Form').form('load', o);
        }
      });
    }
  }

  function admin_Cqpatient_removeFun() {
    var rows = $('#admin_Cqpatient_datagrid').datagrid('getChecked');
    var ids = [];
    if (rows.length > 0) {
      $.messager.confirm('确认', '您是否要删除当前选中的项目？', function(r) {
        if (r) {
          for (var i = 0; i < rows.length; i++) {
            ids.push(rows[i].id);
          }
          $.ajax({
            type: 'post',
            url: '{:U("Cqpatient/delete")}',
            data: {
              ids: ids
            },
            dataType: 'json',
            success: function(r) {
              if (r.status) {
                $('#admin_Cqpatient_datagrid').datagrid('load');
                $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
              }
              showMsg(r.info);
            }
          });
        }
      });
    } else {
      showMsg('请勾选要删除的记录！');
    }
  }
</script>
<script type="text/javascript">
  $(function() {
    $('#admin_Cqpatient_mediatypeid_combobox').combobox({
      multiple: false,
      //url:APP + '/Mediatype/viewWidgetCqpatient',
      data: {$mediatypelist},
      valueField: 'id',
      textField: 'name',
      editable: true,
      panelWidth: 200,
      panelHeight: 300
    }).combobox("initClear");
    $('#admin_Cqpatient_mediaid_combo').combobox({
      multiple: false,
      nowrap: false,
      //url:APP+'/Media/viewWidgetCqpatient',
      data: {$medialist},
      panelWidth: 500,
      panelHeight: 300,
      valueField: 'id',
      textField: 'name',
      groupField: 'mediatypename'
    }).combobox("initClear");
    $('#admin_Cqpatient_diseaseid_combobox').combobox({
      multiple: false,
      //url:APP + '/Disease/viewWidgetCqpatient',
      data: {$diseaselist},
      valueField: 'id',
      textField: 'name',
      editable: true,
      panelWidth: 200,
      panelHeight: 300
    }).combobox("initClear");
    $('#admin_Cqpatient_searchGaojiForm_ofzichanid').combobox({
      multiple : false,
      nowrap : false,
      //url:APP+'/Media/viewWidgetCqpatient',
      data:{$zczhanghaolist},
      panelWidth : 500,
      panelHeight : 500,
      valueField:'id',
      textField:'name',
      groupField:'mediatypename',
      filter: function(q, row){
        var opts = $(this).combobox('options');
        return row['num'].indexOf(q) == 0;
      }
    }).combobox("initClear");
  });
  //删除用户信息
  function admin_Cqpatient_seachFun() {
    $('#admin_Cqpatient_datagrid').datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
    $('#admin_Cqpatient_datagrid').datagrid('load', serializeObject($('#admin_Cqpatient_searchGaojiForm')));
  }
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
  <div data-options="region:'north',title:'当前项目:<font color=red>{$projectlist["name"]}',border:false,collapsed:true" style="height:150px;overflow: hidden;" align="left">
  <form id="admin_Cqpatient_searchGaojiForm">
    <table class="tableForm" border="0">
      <tr>
        <th>编号</th>
        <td><input name="num" style="width: 80px;" /></td>
        <th>姓名</th>
        <td><input name="name" style="width: 80px;" /></td>
        <th>电话</th>
        <td><input name="tel" style="width: 80px;" /></td>
        <th>QQ</th>
        <td><input name="qq" style="width: 80px;" /></td>
        <th>微信</th>
        <td><input name="weixin" style="width: 80px;" /></td>
        <th>状态</th>
        <td><select name="status">
          <option value="">请选择</option>
          <option value="回访中">回访中</option>
          <option value="有意向">有意向</option>
          <option value="已预约">已预约</option>
          <option value="已到院">已到院</option>
          <option value="已删除">已删除</option>
        </select></td>
        <th>几手病人</th>
        <td>
          <select name="jishou">
            <option value="">请选择</option>
            <option value="一手">一手</option>
            <option value="二手">二手</option>
          </select>
        </td>
        <th>客户分类</th>
        <td>
          <select name="kehufenlei">
            <option value="">请选择</option>
            <option value="A">A</option>
            <option value="B">B</option>
            <option value="C">C</option>
            <option value="D">D</option>
          </select>
        </td>
        <td> <a onclick="admin_Cqpatient_seachFun()" class="easyui-linkbutton">查询</a></td>
      </tr>
      <tr>
        <th>渠道</th>
        <td><input id="admin_Cqpatient_mediatypeid_combobox" name="mediatypeid" style="width: 80px;" /></td>
        <th>媒体</th>
        <td><input id="admin_Cqpatient_mediaid_combo" name="mediaid" style="width: 80px;" /></td>
        <th>疾病</th>
        <td><input id="admin_Cqpatient_diseaseid_combobox" name="diseaseid" style="width: 80px;" /></td>
        <th>客服</th>
        <td><input name="username" style="width: 80px;" /></td>
        <th>所属QQ</th>
        <td><input name="ofqq" style="width: 80px;" /></td>
        <th>所属微信</th>
        <td><input name="ofweixin" style="width: 80px;" /></td>
        <th>地区</th>
        <td><select name="islocal">
          <option value="">请选择</option>
          <option value="市内">市内</option>
          <option value="市郊">市郊</option>
          <option value="省内">省内</option>
          <option value="省外">省外</option>
          <option value="其他">其他</option>
        </select></td>
      </tr>
      <tr>
        <th>所属资产</th>
        <td colspan="3"><input id="admin_Cqpatient_searchGaojiForm_ofzichanid" name="ofzichanid" style="width: 150px;" /></td>
        <th>患者注重的问题</th>
        <td><select name="patientcarecase">
          <option value="">请选择</option>
          <option value="费用">费用</option>
          <option value="疗效">疗效</option>
          <option value="治疗周期">治疗周期</option>
          <option value="医院实力">医院实力</option>
          <option value="医生专业度">医生专业度</option>
          <option value="治疗方式">治疗方式</option>
          <option value="其他">其他</option>
        </select>
        </td>
      </tr>
      <tr>
        <th>添加时间：</th>
        <td colspan='4'><input name="addtimestart" id="admin_CqpatientAdd_addtimestart" class="Wdate easyui-validatebox" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'});" data-options="required:true,missingMessage:'选择预约时间'" /> 至
          <input name="addtimeend" id="admin_CqpatientAdd_addtimeend" class="Wdate easyui-validatebox" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'});" data-options="required:true,missingMessage:'选择预约时间'" />
        </td>
        <td colspan='10'>速填:
          <span onclick="choisetime('day',0,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[今天]</span>
          <span onclick="choisetime('day',1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[明天]</span>
          <span onclick="choisetime('day',-1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[昨天]</span>
          <span onclick="choisetime('week',-1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[上周]</span>
          <span onclick="choisetime('week',0,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[本周]</span>
          <span onclick="choisetime('week',1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[下周]</span>
          <span onclick="choisetime('month',0,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[本月]</span>
          <span onclick="choisetime('month',-1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[上月]</span>
          <span onclick="choisetime('year',0,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[今年]</span>
          <span onclick="choisetime('months',-1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[近一个月]</span>
          <span onclick="choisetime('months',-3,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[近三个月]</span>
          <span onclick="choisetime('years',-1,'admin_CqpatientAdd_addtimestart','admin_CqpatientAdd_addtimeend')" style="text-decoration: none; color: #408080">[近一年]</span>
        </td>
      </tr>
    </table>
  </form>
</div>
<div data-options="region:'center',border:false">
  <div id="admin_Cqpatient_datagrid"></div>
</div>
<div data-options="region:'east',title:'',split:true,border:false" style="width:500px;overflow: hidden;">
  <div id="admin_Cqpatient_tab" class="easyui-tabs">
    <div title="基本信息" style="padding:0px;">
      <div align="center" class="easyui-validatebox">
        <form id="admin_Cqpatient_Form_east" method="post"><input name="id" type="hidden" />
          <table class="tableForm" border="1">
            <tr>
              <th width="100">姓名</th>
              <td><input name="name" class="easyui-validatebox" readonly="readonly" data-options="required:false" style="width:100px;" /></td>
              <th width="60">性别</th>
              <td><select name="sex">
                <option value="男">男</option>
                <option value="女">女</option>
              </select></td>
            </tr>
            <tr>
              <th>年龄</th>
              <td><input name="age" class="easyui-numberbox" readonly="readonly" data-options="min:0,max:300,precision:0" style="width: 100px;" /></td>
              <th>*所属资产</th>
              <td colspan="3"><input name="ofzichanid" id="admin_CqpatientEast_ofzichanid" readonly="readonly" data-options="required:true" style="width: 180px;" /></td>
            </tr>
            <tr>
              <!--th>电话</th>
              <td><input name="tel" class="easyui-numberbox" readonly="readonly" data-options="precision:0,required:false" style="width: 100px;" /></td-->
              <th>状态</th>
              <td><select name="status">
                <option value="回访中">回访中</option>
                <option value="有意向">有意向</option>
                <option value="已预约">已预约</option>
                <option value="已到院">已到院</option>
                <option value="已删除">已删除</option>
              </select></td>
            </tr>
            <!--tr>
                <th>QQ</th>
                <td><input name="qq" class="easyui-validatebox" readonly="readonly" style="width: 100px;" /></td>
                <th>微信</th>
                <td><input name="weixin" class="easyui-validatebox" readonly="readonly" style="width: 100px;" /></td>
            </tr-->
            <tr>
              <th>疾病名称</th>
              <td><input name="diseaseid" id="admin_CqpatientEast_diseaseid" readonly="readonly" data-options="required:false" /></td>
              <th>客户分类</th>
              <td><select name="kehufenlei">
                <option value="A">A</option>
                <option value="B">B</option>
                <option value="C">C</option>
                <option value="D">D</option>
              </select></td>
            </tr>
            <tr>
              <th>*媒体来源</th>
              <td><input name="mediaid" id="admin_CqpatientEast_mediaid" readonly="readonly" data-options="required:true" /></td>
              <th>患者注重的问题</th>
              <td colspan="1">
                <input name="patientcarecase" class="easyui-combobox" data-options="required:false,valueField: 'label',
                                    textField: 'value',editable:false,disabled:true,
                                    data: [{
                                      label: '费用',
                                      value: '费用'
                                    },{
                                      label: '疗效',
                                      value: '疗效'
                                    },{
                                      label: '治疗周期',
                                      value: '治疗周期'
                                    },{
                                      label: '医院实力',
                                      value: '医院实力'
                                    },{
                                      label: '医生专业度',
                                      value: '医生专业度'
                                    },{
                                      label: '治疗方式',
                                      value: '治疗方式'
                                    },{
                                      label: '其他',
                                      value: '其他'
                                    }]">
              </td>
            </tr>
            <tr>
              <th>*几手病人</th>
              <td>
                <select name="jishou">
                  <option value="一手">一手</option>
                  <option value="二手">二手</option>
                </select>
              </td>
              <th>*地区</th>
              <td><input name="islocal" class="easyui-combobox" data-options="required:false,valueField: 'label',disabled:true,
                                  textField: 'value',editable:false,
                                  data: [{
                                    label: '市内',
                                    value: '市内'
                                  },{
                                    label: '市郊',
                                    value: '市郊'
                                  },{
                                    label: '省内',
                                    value: '省内'
                                  },{
                                    label: '省外',
                                    value: '省外'
                                  },{
                                    label: '其他',
                                    value: '其他'
                                  }]">
              </td>
            </tr>
            <tr>
              <th>职业分类</th>
              <td colspan="3">
                <input name="zhiyefenlei" class="easyui-combobox" data-options="required:false,valueField: 'label',panelWidth:'300',
                                textField: 'value',editable:false,disabled:true,
                                data: [{
                                  label: '各类专业，技术人员',
                                  value: '各类专业，技术人员'
                                },{
                                  label: '机关，党组织，事业单位人员',
                                  value: '机关，党组织，事业单位人员'
                                },{
                                  label: '办事人员和相关办公室人员',
                                  value: '办事人员和相关办公室人员'
                                },{
                                  label: '商业销售人员',
                                  value: '商业销售人员'
                                },{
                                  label: '商业管理人员',
                                  value: '商业管理人员'
                                },{
                                  label: '服务性工作人员',
                                  value: '服务性工作人员'
                                },{
                                  label: '农林牧渔劳动人员',
                                  value: '农林牧渔劳动人员'
                                },{
                                  label: '生产工作，运输工作和部分体力劳动者',
                                  value: '生产工作，运输工作和部分体力劳动者'
                                },{
                                  label: '其他',
                                  value: '其他'
                                }]">
              </td>
            </tr>
            <tr>
              <th>咨询内容</th>
              <td colspan="5"><textarea name="zixun" readonly="readonly" style="width:400px;height:80px;" class="easyui-validatebox" data-options="required:false"></textarea></td>
            </tr>
            <tr>
              <th>跟踪程度</th>
              <td colspan="5"><textarea name="genzong" readonly="readonly" style="width:400px;height:80px;" class="easyui-validatebox" data-options="required:false"></textarea></td>
            </tr>
            <tr>
              <th>备注</th>
              <td colspan="5"><textarea name="remark" readonly="readonly" style="width:400px;height:80px;"></textarea>
              </td>
            </tr>
          </table>
        </form>
      </div>
    </div>
    <div title="回访" style="overflow:auto;padding:0px;border:0px;">
      <div id="admin_CqpatientHuifang_datagrid_east"></div>
    </div>
  </div>
</div>
</div>